<template>
  <div class="add-line">
    <el-dialog title="提示" :visible="show" width="30%" @close="close">
      <el-form :label-position="'right'" label-width="80px" :model="item">
        <el-form-item label="路径">
          <el-input :value="item.url" @input="changeValue"></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="submit">确认修改</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { updateQrCodeUrl } from "@api/system";
export default {
  props: {
    show: {
      type: Boolean,
      default: false,
    },
    item: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {};
  },
  methods: {
    submit() {
      updateQrCodeUrl(this.item)
        .then((res) => {
          this.$message.success("修改成功");
          this.close();
        })
        .catch((err) => {
          this.$message.success("修改失败");
        });
    },
    changeValue(e) {
      const { item } = this;
      item.url = e;
      this.$emit("update:item", item);
    },
    close() {
      this.$emit("update:show", false);
    },
  },
};
</script>

<style lang="scss" scoped>
.add-line {
}
</style>
